<!DOCTYPE html>
<html lang="cn">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style type="text/css">
        #box{
            width: 400px;
            height: 300px;
            border: 1px solid #000;
        }
    </style>
</head>
<body>
    <h1>JS 鼠标事件-按下-松开-移动</h1>
    <hr>

    <div id="box"></div>

    <script>
        box.onmousedown = function(en) {
            this.style.backgroundColor = '#f90';
            console.log(en.button); 
        }

        box.onmouseup = function() {
            this.style.backgroundColor = '#09f';
        }

        box.onmousemove = function(en) {
            console.log('我在移动: ' + Math.random());
            document.title = en.x + "," + en.y;
        }
    </script>
</body>
</html>